vector->string - convert a vector of characters to a string

LIBRARY

(import (scheme base))              ;R7RS

SYNOPSIS

(vector->string vector)
(vector->string vector start)
(vector->string vector start end)

DESCRIPTION

Returns a newly allocated string of the objects contained in the elements of vector between start (inclusive) and end (exclusive). The order of the characters is preserved.

The argument start defaults to 0 and end defaults to the length of vector.

IMPLEMENTATION NOTES

Loko Scheme
There is a single unique empty string object, so the returned string will not always be newly allocated.

RETURN VALUES

Returns a single value; a string.

EXAMPLES

(vector->string #(#\1 #\2 #\3))  =>  "123"

RATIONALE

R7RS says that this procedure and a few others were added in order to round out the sequence operations.

COMPATIBILITY

This procedure is unique to R7RS. Compatible procedures can be found in SRFI-133 and SRFI-152.

ERRORS

It is an error to pass the wrong number of arguments, and to pass an argument that is outside its domain. In particular, vector must be a vector of characters supported by the implementation, start must be non-negative and not greater than end, and end must not be greater than the length of vector. The only characters that must be supported by R7RS implementations are the ASCII characters minus NUL. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

SEE ALSO

string->vector(3scm)

STANDARDS

R7RS

HISTORY

This procedure first appeared in R7RS.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.